//
//  Service.swift
//  TCSTARNewWork
//
//  Created by kate on 2023/5/15.
//

import Foundation
import RxSwift
import Moya

struct NetWorkService {
            
    let provider = MoyaProvider<NetWorkAPI>(plugins: [RequestLoadingPlugin()])
    
    func sendMsg(sendId: String, receiveId: String, typeId: String, content: String) -> Observable<Any> {
        provider.rx.request(.sendMsg(sendId: sendId, receiveId: receiveId, typeId: typeId, content: content)).asObservable().mapJSON()
    }
    
    func reveiveMsg(receiveId: String, msgParamList: [[String:String]]) -> Observable<[ReceiveMsgModel]>{
        provider.rx.request(.receiveMsg(receiveId: receiveId, msgParamList: msgParamList)).mapJSON().asObservable() .mapHandyJSON2Array(ReceiveMsgModel.self)
    }
}
